home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 December / PCWorld_2007-12_cd.bin / v cisle / htttrack / httrack-3.41-3.exe / {app} / src / htsthread.h < prev    next >
C/C++ Source or Header  |  2006-07-29  |  3KB  |  93 lines

  1. /* ------------------------------------------------------------ */
  2. /*
  3. HTTrack Website Copier, Offline Browser for Windows and Unix
  4. Copyright (C) Xavier Roche and other contributors
  5.  
  6. This program is free software; you can redistribute it and/or
  7. modify it under the terms of the GNU General Public License
  8. as published by the Free Software Foundation; either version 2
  9. of the License, or any later version.
  10.  
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with this program; if not, write to the Free Software
  18. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  19.  
  20.  
  21. Important notes:
  22.  
  23. - We hereby ask people using this source NOT to use it in purpose of grabbing
  24. emails addresses, or collecting any other private information on persons.
  25. This would disgrace our work, and spoil the many hours we spent on it.
  26.  
  27.  
  28. Please visit our Website: http://www.httrack.com
  29. */
  30.  
  31.  
  32. /* ------------------------------------------------------------ */
  33. /* File: Threads                                                */
  34. /* Author: Xavier Roche                                         */
  35. /* ------------------------------------------------------------ */
  36.  
  37. #ifndef HTS_DEFTHREAD
  38. #define HTS_DEFTHREAD
  39.  
  40. #include "htsglobal.h"
  41. #ifndef _WIN32
  42. #include <pthread.h>
  43. #endif
  44. #ifdef _WIN32
  45. #include "windows.h"
  46. #ifdef _WIN32_WCE
  47. #ifndef HTS_CECOMPAT
  48. #include "cethread.h"
  49. #endif
  50. #endif
  51. #endif
  52. #ifndef USE_BEGINTHREAD
  53. #error needs USE_BEGINTHREAD
  54. #endif
  55.  
  56. /* Forward definition */
  57. #ifndef HTS_DEF_FWSTRUCT_htsmutex_s
  58. #define HTS_DEF_FWSTRUCT_htsmutex_s
  59. typedef struct htsmutex_s htsmutex_s, *htsmutex;
  60. #endif
  61. #define HTSMUTEX_INIT NULL
  62.  
  63. #ifdef _WIN32
  64. struct htsmutex_s {
  65.   HANDLE handle;
  66. };
  67. #else  /* #ifdef _WIN32 */
  68. struct htsmutex_s {
  69.   pthread_mutex_t handle;
  70. };
  71. #endif  /* #ifdef _WIN32 */
  72.  
  73. /* Library internal definictions */
  74. HTSEXT_API int hts_newthread( void (*fun)(void *arg), void *arg);
  75. #ifndef HTTRACK_DEFLIB
  76. HTSEXT_API void htsthread_wait(void );
  77. #endif
  78. HTSEXT_API void htsthread_wait_n(int n_wait);
  79.  
  80. /* Locking functions */
  81. HTSEXT_API void hts_mutexinit(htsmutex* mutex);
  82. HTSEXT_API void hts_mutexfree(htsmutex* mutex);
  83. HTSEXT_API void hts_mutexlock(htsmutex* mutex);
  84. HTSEXT_API void hts_mutexrelease(htsmutex* mutex);
  85.  
  86. #ifdef HTS_INTERNAL_BYTECODE
  87. /* Thread initialization */
  88. HTSEXT_API void htsthread_init(void);
  89. HTSEXT_API void htsthread_uninit(void);
  90. #endif
  91.  
  92. #endif
  93.